<?php

namespace common\models\credit_app_tables;

use Yii;

/**
 * This is the model class for table "{{%api_token}}".
 *
 * @property int $tk_id
 * @property int $tk_uid
 * @property string $tk_token
 * @property int $tk_expiration
 */
class ApiToken extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%api_token}}';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('db_app');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['tk_uid', 'tk_token', 'tk_expiration'], 'required'],
            [['tk_uid', 'tk_expiration'], 'integer'],
            [['tk_token'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'tk_id' => Yii::t('app', 'Tk ID'),
            'tk_uid' => Yii::t('app', 'Tk Uid'),
            'tk_token' => Yii::t('app', 'Tk Token'),
            'tk_expiration' => Yii::t('app', 'Tk Expiration'),
        ];
    }
}
